/**
 * 文 件 名：Book.java
 * CopyRight (c) 2013 Anze, Inc. All rights reserved.
 * 创 建 人：lurf
 * 日      期：2013-9-17 下午10:14:17
 * 描      述：
 */
package com.anze.abd.persistence.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 描述：图书信息
 * @author lurf 2013-9-17
 * @version 2.0.0
 * @since 2.0.0
 */
@Table(name = "BOOK")
@Entity
public class Book implements Serializable {

	private static final long serialVersionUID = -5693714397066430449L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "ID")
	private Long id;

	/**
	 * 书名
	 */
	@Column(name = "NAME")
	private String name;
	
	/**
	 * 作者
	 */
	@Column(name = "AUTHOR")
	private String author;
	
	/**
	 * 单价
	 */
	@Column(name = "PRICE")
	private Double price;
	
	/**
	 * 描述
	 */
	@Column(name = "DESCRIPTION")
	private String description;

	@Column(name = "CREATOR")
	private String creator;

	@Column(name = "UPDATOR")
	private String updator;

	@Column(name = "CREATE_TIMESTAMP")
	private Date createTimestamp;

	@Column(name = "UPDATE_TIMESTAMP")
	private Date updateTimestamp;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return 书名
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name 书名
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return 作者
	 */
	public String getAuthor() {
		return author;
	}

	/**
	 * @param author 作者
	 */
	public void setAuthor(String author) {
		this.author = author;
	}

	/**
	 * @return 单价
	 */
	public Double getPrice() {
		return price;
	}

	/**
	 * @param price 单价
	 */
	public void setPrice(Double price) {
		this.price = price;
	}

	/**
	 * @return 描述
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description 描述
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public String getUpdator() {
		return updator;
	}

	public void setUpdator(String updator) {
		this.updator = updator;
	}

	public Date getCreateTimestamp() {
		return createTimestamp;
	}

	public void setCreateTimestamp(Date createTimestamp) {
		this.createTimestamp = createTimestamp;
	}

	public Date getUpdateTimestamp() {
		return updateTimestamp;
	}

	public void setUpdateTimestamp(Date updateTimestamp) {
		this.updateTimestamp = updateTimestamp;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((author == null) ? 0 : author.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((price == null) ? 0 : price.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Book other = (Book) obj;
		if (author == null) {
			if (other.author != null)
				return false;
		} else if (!author.equals(other.author))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (price == null) {
			if (other.price != null)
				return false;
		} else if (!price.equals(other.price))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Book [id=" + id + ", name=" + name + ", author=" + author + ", price=" + price + ", description="
				+ description + ", creator=" + creator + ", updator=" + updator + ", createTimestamp=" + createTimestamp
				+ ", updateTimestamp=" + updateTimestamp + "]";
	}
}
